package hadoop.ch03.v17124080112;
import java.net.URI;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
public class DeleteHDFSFile {
    public static void main(String[] args) throws Exception {
        Configuration conf = new Configuration();
        // 配置 NameNode 地址，具体根据你的NameNode IP 配置
        URI uri = new URI("hdfs://192.168.30.131:8020");
        // 指定用户名 , 获取 FileSystem 对象
        FileSystem fs = FileSystem.get(uri, conf, "hadoop");
        //HDFS file
        Path path = new Path("/17124080112/test5.txt");
        fs.delete(path);
        // 不需要再操作 FileSystem 了，关闭
        fs.close();

        System.out.println("Delete Successfully!");
    }
}
